import { UserActonType } from '../actionTypes';
import { AppDispatch } from '@/store';
import { login } from '@/api/login';
import type { loginFormType } from '@/types/user';
// import { setToken } from '@/utils/auth';

export const loginAction = (loginForm: loginFormType) => {
  return async (dispatch: AppDispatch) => {
    const res: any = await login(loginForm.username, loginForm.password, loginForm.code, loginForm.uuid);
    // setToken(res.token);
    dispatch({ type: UserActonType.LOGIN, payload: res });
  };
};
